package com.lz.core;

import io.vertx.core.Vertx;
import io.vertx.core.VertxOptions;
import io.vertx.core.http.HttpServer;

/**
 * FirstVertx..
 *
 * It’s the control centre of Vert.x and is how you do pretty much everything,
 * including creating clients and servers, getting a reference to the event bus,
 * setting timers, as well as many other things.
 *
 * @author Lizhong
 * @date 2019/9/3
 */

public class FirstVertx {
    public void method01() {
        Vertx vertx = Vertx.vertx();
        Vertx vertx0 = Vertx.vertx(new VertxOptions().setWorkerPoolSize(40));

        HttpServer httpServer = vertx.createHttpServer();
        httpServer.requestHandler(req -> {
            System.out.println(req.path());
            System.out.println(req.method());

            req.response().end("Hello world");
        }).listen(1024, res -> {

            if (res.succeeded()) {
                System.out.println("Server is now listening!");
            } else {
                System.out.println("Failed to bind!");
            }
        });
    }

    public static void main(String[] args) {
        FirstVertx firstVertx = new FirstVertx();
        firstVertx.method01();
    }
}
